#include <buola/chart/ccolorsequence.h>

namespace buola { namespace chart {

std::vector<img::CColor> CColorSequence::mColors;

CColorSequence::CColorSequence()
    :   mPos(0)
{
    if(!mColors.size())
    {
        mColors.push_back(img::CColor(L"darkslateblue"));
        mColors.push_back(img::CColor(L"yellowgreen"));
        mColors.push_back(img::CColor(L"tomato"));
        mColors.push_back(img::CColor(L"gold"));
        mColors.push_back(img::CColor(L"purple"));
        mColors.push_back(img::CColor(L"royalblue"));
        mColors.push_back(img::CColor(L"seagreen"));
        mColors.push_back(img::CColor(L"mediumorchid"));
        mColors.push_back(img::CColor(L"brown"));
        mColors.push_back(img::CColor(L"lightsteelblue"));
        mColors.push_back(img::CColor(L"coral"));
        mColors.push_back(img::CColor(L"steelblue"));
        mColors.push_back(img::CColor(L"darkseagreen"));
        mColors.push_back(img::CColor(L"hotpink"));
        mColors.push_back(img::CColor(L"teal"));
        mColors.push_back(img::CColor(L"darkorange"));
        mColors.push_back(img::CColor(L"orchid"));
        mColors.push_back(img::CColor(L"forestgreen"));
        mColors.push_back(img::CColor(L"firebrick"));
        mColors.push_back(img::CColor(L"indigo"));
        mColors.push_back(img::CColor(L"orange"));
        mColors.push_back(img::CColor(L"darkslategray"));
        mColors.push_back(img::CColor(L"deeppink"));
        mColors.push_back(img::CColor(L"peru"));
        mColors.push_back(img::CColor(L"slategray"));
        mColors.push_back(img::CColor(L"indianred"));
        mColors.push_back(img::CColor(L"slateblue"));
        mColors.push_back(img::CColor(L"darkmagenta"));
        mColors.push_back(img::CColor(L"sienna"));
        mColors.push_back(img::CColor(L"midnightblue"));
        mColors.push_back(img::CColor(L"orangered"));
        mColors.push_back(img::CColor(L"maroon"));
    }
}

CColorSequence::~CColorSequence()
{
}

const img::CColor &CColorSequence::operator() ()
{
    return mColors[(mPos++)%mColors.size()];
}

const img::CColor &CColorSequence::operator[](int i)
{
    return mColors[i%mColors.size()];
}

/*namespace chart*/ } /*namespace buola*/ }
